package deanandjames.image;

import java.awt.*;

public class BackgroundManager {
	private final double moveFactors[] = {0.1, 0.5, 1.0};
	private final int moveSize;
	private final int numberOfRibbons;
	private final String ribbonImages[] = {"mountains", "houses", "trees"};
	private final Ribbon[] ribbons;

	public BackgroundManager(int w, int h, int brickMoveSize, ImageLoader imsLd) {
		moveSize = brickMoveSize;
		numberOfRibbons = ribbonImages.length;
		ribbons = new Ribbon[numberOfRibbons];
		for (int i = 0; i < numberOfRibbons; i++) {
			ribbons[i] = new Ribbon(w, h, imsLd.getImage(ribbonImages[i]), (int) (moveFactors[i] * moveSize));
		}
	}

	public void display(Graphics g) {
		for (int i = 0; i < numberOfRibbons; i++) {
			ribbons[i].display(g);
		}
	}

	public void moveLeft() {
		for (int i = 0; i < numberOfRibbons; i++) {
			ribbons[i].moveLeft();
		}
	}

	public void moveRight() {
		for (int i = 0; i < numberOfRibbons; i++) {
			ribbons[i].moveRight();
		}
	}

	public void stayStill() {
		for (int i = 0; i < numberOfRibbons; i++) {
			ribbons[i].stayStill();
		}
	}

	public void update() {
		for (int i = 0; i < numberOfRibbons; i++) {
			ribbons[i].update();
		}
	}
}
